<?php

/*
 * CopyRight  : (C)2012-2099 HaoTeam Inc.
 * Document   : ArticleValidate.php
 * Created on : 2021-1-28 11:23:21
 * Author     : Tiger <1192851302@qq.com>
 * Description: This is NOT a freeware, use is subject to license terms.
 *              这即使是一个免费软件,使用时也请遵守许可证条款,得到当时人书面许可.
 *              未经书面许可,不得翻版,翻版必究;版权归属 HaoTeam Inc;
 */

namespace haoteam\http\validates;

use think\Validate;

/**
 * 内容类别验证器
 * Class ArticleValidate
 * Tiger <1192851302@qq.com> 2021-1-28 11:23:21
 */
class ArticleValidate extends Validate {

    protected $rule = [
        'id' => 'require|number',
        'category_id' => 'require|number',
        'title' => 'require|max:50',
        //'cover_image' => 'require|url',
        'message' => 'require'
    ];
    protected $message = [
        'id.require' => 'ID不能为空',
        'id.number' => 'ID格式不对',
        'category_id.require' => '类别不能为空',
        'category_id.number' => '类别式不对',
        'title.require' => '名称不能为空',
        //'title.chsDash' => '名称只能是汉字、字母、数字和下划线_及破折号-',
        'title.max' => '名称最多50个汉字',
        //'cover_image.require' => '封面不能为空',
        //'cover_image.url' => '封面格式不正确',
        'message.require' => '内容不能为空',
    ];
    protected $scene = [
        'create' => ['category_id', 'title', 'message'],
        'update' => ['id', 'category_id', 'title', 'message'],
        'delete' => ['id']
    ];

}
